from ftplib import FTP
from time import strptime, mktime

class ftpext(FTP):

    def mdtm(self, filename):
        resp = self.sendcmd('MDTM ' + filename)
        if resp[:3] == '213':
            s = resp[3:].strip()
            try:
                t = strptime(s, '%Y%m%d%H%M%S')
                return mktime(t)
            except:
                return None


